<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of SelectFiles</title>
  <meta name="keywords" content="SelectFiles">
  <meta name="description" content="Prompt user for directory containing files">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- ../menu.html trunk --><!-- menu.html utils -->
<h1>SelectFiles
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>Prompt user for directory containing files</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>This is a script file. </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Prompt user for directory containing files</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
</ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <span class="comment">% Prompt user for directory containing files</span>
0002 zPathName = uigetdir;
0003 Files = dir(zPathName);
0004 allFiles = {Files.name};
0005 filefind=strfind(allFiles,<span class="string">'.mat'</span>)';
0006 filesidx=nan(size(filefind,1),1);
0007 <span class="keyword">for</span> i=1:size(filefind,1)
0008     filesidx(i,1)=size(filefind{i},1);
0009 <span class="keyword">end</span>
0010 filesidx=find(filesidx&gt;0);
0011 files=allFiles(filesidx);
0012 
0013 <span class="comment">% Allow user to select which files are to be processed</span>
0014 selection = listdlg(<span class="string">'ListSize'</span>,[300 300],<span class="string">'ListString'</span>, files);
0015 zFileName = files(selection);
0016 
0017 <span class="comment">% Determine number of files to be processed</span>
0018 <span class="keyword">if</span>  isa(zFileName,<span class="string">'cell'</span>)
0019     zf=size(zFileName,2);
0020     zFileName=sort(zFileName);       
0021 <span class="keyword">else</span>
0022     zf=1;
0023     zFileName={zFileName}
0024 <span class="keyword">end</span>
0025 
0026 clear Files allFiles filefind files filesidx i selection zPathName</pre></div>
<hr><address>Generated on Wed 04-Jun-2014 14:21:02 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>